#include <stdio.h>

int trim(char * str, char c)
{
	if(!str)
		return -1;
	char *p = str;
	int i = 0;
	while(*p)
	{
		while(*(p+i)==c)
			i++;
		*p = *(p+i);

		if(*p==0)
			break;
		p++;
	}
	return i;
}



int main(int argc, char **argv)
{
	char buf[] = "h el l o wor ld !";

	printf("[%s]:before trim:%s\n", __FUNCTION__, buf);

	int times = trim(buf, ' ');

	printf("[%s]:after trim:%s, times:%d\n", __FUNCTION__, buf, times);
	return 0;

}
